package interfaces.app;

import exceptions.CommandNotFoundException;
import exceptions.CreatingProcessException;
import interfaces.data.IHandle;

/**
 * Create new process.
 * <br/>
 * Created: 11.10.11
 *
 * @author Martin Štulc (<a href="mailto:martin.stulc@gmail.com">martin.stulc@gmail.com</a>)
 * @version 1.0
 */
public interface IProcessCreator
{
    /**
     * Create new process.
     *
     * @param parent the parent process of a new process
     * @param handle a handle of process
     * @return the new process
     * @throws CreatingProcessException Thrown if failed creating process.
     * @throws CommandNotFoundException Inherited from CreatingProcessException. Thrown if class for command wasn't found.
     */
    IProcess createProcess(final IProcess parent, IHandle handle) throws CreatingProcessException;

    /**
     * Create new root process, parent of new process is null. Must set actual path in handle according to username.
     *
     * @return the new process
     * @throws CreatingProcessException Thrown if failed creating process.
     */
    IProcess createRootProcess() throws CreatingProcessException;
}
